<template>
  <div>
    <h1>我是App组件</h1>
    <input type="text" />
    <button @click="getMsg">获取input</button>
    <Count ref="count" />
    <Movie ref="movie" />
  </div>
</template>

<script>
import Count from "./components/Count.vue";
import Movie from "./components/Movie.vue";
export default {
  name: "App",
  components: { Count, Movie },
  methods: {
    /* 
      如果ref设置给了子组件上,则我们通过$refs拿到的是这个组件的组件实例
      最常用的就是通过子组件的实例拿到子组件的数据进行处理(组件通信-->子传父)    
    */
    getMsg() {
      console.log(this.$refs.count); //子组件实例
      // console.log(this.$refs.count.count);
    },
  },
};
</script>

<style>
</style>